package GlavFinans::Validator;

use base 'Validator::Custom';
use Email::Valid;

# TODO: 
# patch for Validator::Custom
# line 320, sub validate {}
# my $check = (exists $data->{$key});
# unless ( $check || defined $check ) {


sub new {
	my $self = shift->SUPER::new(@_);
	$self->register_constraint(
		phone => sub {
			return 1 if shift =~ /^\+?[\d\(\)-]+$/;
			return 0;
		},
		email => sub {
			return Email::Valid->address(shift);
    	}
	);
	return $self;
}
  
1;